Skip to content

Operator M.v font lock. #442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2015
Merged

Operator M.v font lock. #442

merged 1 commit into from
Jan 23, 2015

Conversation

gracjan
Copy link
Contributor

@gracjan gracjan commented Jan 21, 2015

Font lock for M.v should be operator face same as v.

Fixes #438.

@purcell
Copy link
Member

purcell commented Jan 22, 2015

Not sure why the line order changed here -- does the expensive comment line still apply? Also qvarid appears to be "qualified varid", so you should probably use that instead of the hand-rolled [[:alnum:]] etc.

@gracjan
Copy link
Contributor Author

gracjan commented Jan 22, 2015

Well, font-lock syntax for haskell is in a need for refactoring. To answer your question:

qvarid is only module prefixed version and does not apply to both. What we need is a qualified-or-plain-varid. This is not defined so that is why I went with just inline regex.

Order of rules needed to be changed because otherwise a line later that matches conid and qconid would match conid and qconid. So my line had to be before.

Leftovers like ;; Expensive or Emacs 21 support needs to be cleared up.

Note that the line

(,reservedsym 1 haskell-operator-face)

appears three times for no reason. That is the best testimony to the quality of this fragment of the code.

Does anybody have pointers to an example how to write unit tests for font-lock or have some more interactive way of working with syntax definitions?

@purcell
Copy link
Member

purcell commented Jan 22, 2015

That is the best testimony to the quality of this fragment of the code.

:-)

Does anybody have pointers to an example how to write unit tests for font-lock or have some more interactive way of working with syntax definitions?

There's https://github.com/Lindydancer/font-lock-studio, which might help.

@gracjan
Copy link
Contributor Author

gracjan commented Jan 22, 2015

Is this merged?

@purcell
Copy link
Member

purcell commented Jan 22, 2015

Is this merged?

Not yet, no. Isn't there a way to combine qvarid and varid instead of repeating the [[:alnum:]] incantation? Something like (concat "\\(?:" varid "\\|" qvarid "\\)") would perhaps do the trick.

@gracjan
Copy link
Contributor Author

gracjan commented Jan 22, 2015

Sadly modid is defined using normal group not the shy group, so it does not compose:

(modid (concat "\\b" conid "\\(\\." conid "\\)*\\b"))

So using qvarid and qconid might bring trouble in places. So I went with the obvious four-liner that you see in the commit (the new one).

Font lock for `M.v` should be operator face same as `v`.
@gracjan
Copy link
Contributor Author

gracjan commented Jan 23, 2015

@purcell: what about this?

purcell added a commit that referenced this pull request Jan 23, 2015
@purcell purcell merged commit 4619c5e into haskell:master Jan 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Identifiers within backticks not highlighted when prefixed with module name
2 participants